<?php
namespace app\api\controller\deerhome\user;

use app\api\controller\deerhome\user\Base;
use think\Db;
use app\admin\model\deerhome\Card as CardModel;
/**
 * 首页接口
 */
class Location extends Base
{
    /**
     * 首页
     *
     */
    public function index()
    {
        $data = [
            'initlocation'=>[
                'longitude'=>114.314278,
				'latitude'=>34.798083,
            ],
        ];
        $this->ok($data);
    }

    public function chooseLocationPanduan()
    {
        $address = $this->request->param("address","");
        $latitude = $this->request->param("latitude","");
        $longitude = $this->request->param("longitude","");
        $region = ['龙亭区','鼓楼区','顺河回族区','禹王台区','祥符区'];

        $region_contain = false;

        foreach ($region as $substr) {
            if (mb_strpos($address, $substr) !== false) { //在字符串中
                $region_contain = true;
                break;
            }
        }

        if(mb_strpos($address,'开封') && $region_contain){
            $this->ok();
        }
        $this->err("抱歉,此区域不在服务范围内",1);

    }

   
}
